package edebe.flyinginstrument.item;

import edebe.flyinginstrument.entity.EntityFlyingInstrument;
import edebe.flyinginstrument.loader.ItemLoader;
import net.mcreator.fabaokuozhan.creativetab.TabLianqi;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

import static edebe.flyinginstrument.FlyingInstrumentMod.MODID;

public class ItemFlyingInstrument extends Item implements IFlyingInstrumentItem {
    public ItemFlyingInstrument(String id) {
        setRegistryName(id);
        setUnlocalizedName(MODID + "." + id);
        setCreativeTab(TabLianqi.tab);
        setMaxStackSize(1);
    }

    @Override
    public float getWidth() {
        if (this == ItemLoader.GOURD)
            return 1.6F;
        else if (this == ItemLoader.LEAF)
            return 4F;
        else if (this == ItemLoader.BOAT)
            return 5F;
        else if (this == ItemLoader.MOUNTAIN_AND_RIVER_DIAGRAM)
            return 6F;
        else return 0;
    }

    @Override
    public float getHeight() {
        if (this == ItemLoader.GOURD)
            return 1.2F;
        else if (this == ItemLoader.LEAF)
            return 0.3F;
        else if (this == ItemLoader.BOAT)
            return 1.4F;
        else if (this == ItemLoader.MOUNTAIN_AND_RIVER_DIAGRAM)
            return 0.2F;
        else return 0;
    }

    @Override
    public double getMountedYOffset() {
        if (this == ItemLoader.GOURD)
            return 0.9;
        else if (this == ItemLoader.LEAF)
            return 0.5;
        else if (this == ItemLoader.BOAT)
            return 0.5;
        else if (this == ItemLoader.MOUNTAIN_AND_RIVER_DIAGRAM)
            return 0.5;
        else return 0;
    }

    @Override
    public float getStepHeight() {
        return 32;
    }

    @Override
    public boolean shouldRiderSit() {
        return this == ItemLoader.GOURD;
    }

    @Override
    public EntityFlyingInstrument createEntity(World worldIn, ItemStack stackIn, EntityPlayer playerIn) {
        return new EntityFlyingInstrument(worldIn, stackIn, playerIn);
//        return new EntityFlySword(worldIn, stackIn, playerIn);
    }
}
